Givet /^att jag inte har några planerade händelser$/ do
  @schedule = TriggerSwitchD::Schedule.create
end

När /^jag läser in planerade händelser från fil$/ do
  file = File.open("db/scheduled_actions","r")
  datum = (instance_variables.include? "@datum") ? @datum : Date.today
  latitud = (instance_variables.include? "@latitude") ? @latitude : 0
  longitud = (instance_variables.include? "@longitude") ? -@longitude : 0
  environment = TriggerSwitchD::Config.default_environment
  environment[:at_location] = {:north => latitud, :west => longitud}
  begin
    TriggerSwitchD::load_scheduled_actions(file,datum) { |code_line, date| @schedule.schedule_action(TriggerSwitchD::Action.new(code_line,@devices,environment,date))}
  rescue => @exception
    pp @exception
  end
  file.close
end